# !/usr/bin/env python
# -*- coding: utf-8 -*-

import threading
import time


def sing():
    for i in range(3):
        print("is singing... %d" % i)
        time.sleep(1)


def dance():
    for i in range(3):
        print("is dancing... %d" % i)
        time.sleep(1)


def test(a, b, c):
    print("a=%d,b=%d,c=%d" % (a, b, c))
    time.sleep(1)


if __name__ == '__main__':
    thread_list = threading.enumerate()
    print("\nCurrent number of threads：%d" % len(thread_list))
    print("The main thread starts to execute")

    # 使用元组和字典传参
    # thread_obj = threading.Thread(target=test, args=(10, 20, 30))
    # thread_obj = threading.Thread(target=test, kwargs={"a": 10, "c": 20, "b": 30, })
    thread_obj = threading.Thread(target=test, args=(10,), kwargs={"c": 20, "b": 30, })

    # 启动子线程对象
    thread_obj.start()

    t1 = threading.Thread(target=sing)
    t2 = threading.Thread(target=dance)

    t1.start()
    t2.start()

    print("Main thread execution completed")
    thread_list = threading.enumerate()
    print("\nCurrent number of threads：%d" % len(thread_list))
